package com.skin.admin.controller;

import com.skin.admin.manager.UploadfileManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;


/**
 * 上传文件
 * Created by Administrator on 2018/8/8 0008.
 */
@Controller
@RequestMapping("/upload")
public class UploadController {

    private static final Logger logger= LoggerFactory.getLogger(UploadController.class);

    private String datePath=new SimpleDateFormat("yyyyMMdd").format(new Date());

    @Autowired
    UploadfileManager uploadfileManager;

    @RequestMapping("/uploadimage")
    @ResponseBody
    public Integer uploadimage(@RequestParam("file")MultipartFile multipartFile, HttpServletRequest request) throws Exception{
        return uploadfileManager.saveimgdb(multipartFile,request);
    }

}
